<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页面</title>
</head>
<body>
	<?php 
     //接收表单数据


  
    require_once("./system/dbConn.php");
    connect();


	$username=$_POST["username"];
	$password=$_POST["password"];

    $sql="select * from users where uname='$username' and password=md5('$password')";
    //echo $sql."<br>";
    $result=mysql_query($sql);//结果集
    $num=mysql_num_rows($result);
    if($num>0){//查到了
    	//将管理员的名字和adminID记录到session中
       // $row=mysql_num_rows($result);
        $row=mysql_fetch_assoc($result);
    	session_start();//启动session(会话)
    	$_SESSION["username"]=$username;
        $_SESSION["uid"]=$row["uid"];
        // var_dump($row["adminid"]);
        if (isset($_POST["vid"])) {
            $vid=$_POST["vid"];
             echo"登录成功，3秒后返回";
        header("refresh:3;url='show.php?vid=$vid'");//需要参数vid
        }
        else{
     echo"登录成功，3秒后跳回首页";
        header("refresh:3;url='index.php'");

        }

   } 
    else{
        if (isset($_POST["vid"])) {
            $vid=$_POST["vid"];
             echo"登录失败，3秒后返回";
        header("refresh:3;url='show.php?vid=$vid'");
        }
        else{
     echo"登录失败，3秒后跳回首页";
        header("refresh:3;url='index.php'");
            
        }

    }





	 ?>
</body>
<html>
